package com.platform.modules.mall.activity.restrict;

import com.platform.modules.mall.activity.entity.bo.ActivityGoshoppingBo;
import com.platform.modules.mall.entity.MallActivityEntity;
import com.platform.modules.mall.entity.MallGoodsToActivityEntity;
import com.platform.modules.mall.entity.MallWhitelistEntity;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 白名单手机等级验证
 * 1.可能存在多条数据，排序，有效日期最近的先试用
 * 2.不存在数据就说明不在白名单中间
 */
@Component(value = "whitelistLevelVerify")
public class WhitelistLevelVerify extends WhitelistPhoneVerify {


    @Override
    public List<MallGoodsToActivityEntity> getList(MallActivityEntity activity,ActivityGoshoppingBo bo) {
        Object le =  bo.getData();
        if (le!=null){
            Map<String, Object> params =new HashMap<>();
            params.put("activityId",activity.getId());
            params.put("level",((MallWhitelistEntity)le).getLevel());
            params.put("orderbySort"," order by T.SORT ");
            List<MallGoodsToActivityEntity> list = mallGoodsToActivityService.queryAll(params);
            return list;
        }
        return super.getList(activity,bo);

    }

}
